package com.sumainfor.zuul.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface getDeptMapper {

    /**
     * 查询所有服务中心
     * @return
     */
    @Select("\tSELECT dept_id AS value ,`name` AS label FROM sys_dept \n" +
            "\tWHERE  dept_id  IN (\n" +
            "\tSELECT  dept_id FROM sys_area_dept\t \n" +
            "\tWHERE area_id IN(\n" +
            "\tSELECT  area_id FROM sys_user\t\n" +
            "\t WHERE user_id=#{userid})\n" +
            "\t) AND `type`=3\n" +
            "\t")
    public List<Map<String,Object>> getdeptByType(Map<String,Object> params);


    /**
     * 根据id 查询服务中心名字
     * @param id
     * @return
     */
    @Select("SELECT `name` AS deptname FROM sys_dept WHERE dept_id=#{0}")
    public  String getnamebyid(String id);
}
